'''
Created on Jun 2, 2010

@author: yglazner
'''
import unittest
from wp import Worker
from multiprocessing.managers import BaseManager

class RemoteManager(BaseManager): pass
RemoteManager.register('get_worker')

class TestWorker(unittest.TestCase):


    def test_execute_remote_task(self):
        p = []
        class MyWorker(Worker):
            def f(self,num):
                p.append(num)
                return p
            def f2(self,num):
                p.append(num)
                return tuple(p)
            
        myWorker = MyWorker()
        assert myWorker.execute_remote_task('f',0) is p
        assert p[0]==0
              
#        try: MyWorker
    def test_alive(self):
        worker = Worker()
        assert worker.alive() == True


if __name__ == "__main__":
    #import sys;sys.argv = ['', 'Test.testName']
    unittest.main()